<template>
    <div>
        <div>vue-router</div>
        <div>----------------------------------------------------------</div>
        <!-- 点击跳转到demo9 -->
        <router-link to="demo9">demo9</router-link>
        <div>----------------------------------------------------------</div>
        <!-- params 传参 -->
        <router-link :to="{name:'demo8', params:{userId:123}}">params</router-link>

        <div>----------------------------------------------------------</div>
        <router-link :to="{name:'demo8', params:{userId:123},query:{plan:'private'}}">query</router-link>
        <!-- http://localhost:8081/#/demo8/123?plan=private -->
        
        <div>----------------------------------------------------------</div>
        <!-- js跳转 -->
        <button @click="toUrl">跳转</button>    
   
    </div>
</template>
<script>
export default {
    data(){
        return{

        }
    },
    methods:{
        toUrl(){
            // this.$router.push({path:'/demo9'})
            // this.$router.push({name:'demo8', params:{userId:123}})
            this.$router.push({name:'demo8', params:{userId:123},query:{plan:'private'}})
        }
    }
}
</script>









